import java.util.PriorityQueue;

public class demo2 {
    public int[] smallestK(int[]nums, int k) {
        PriorityQueue<Integer> priorityQueue=new PriorityQueue<>();
        for (int i=0;i<nums.length;i++){
            priorityQueue.offer(nums[i]);
        }
        int []arr=new int[k];
        for (int i = 0; i <k ; i++) {
            arr[i]=priorityQueue.poll();
        }
        return arr;
    }
}
